<template>
  <div class="hello">
    
     <div v-for="(item, index) in articleList" :key="index" @click="emitIndex(index)">{{item}}</div>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  mounted(){
    console.log(this.$parent.articleList);
  }
  ,
  data() {
    return {
      currentIndex: -1,
      articleList: ['红楼梦', '西游记', '三国演义'],
      message: 'Vue'
    }
    
  },
  computed:{
    parentVal(){
      return this.$parent.data;
    }
  },
  methods: {
    emitIndex(index) {
      this.$emit('onEmitIndex', index) // 触发父组件的方法，并传递参数index
    }
  }


}
</script>
